import sendMsg from "../utils/sendMsg";
export const  voiceMsg =async (vm,voiceData)=>{
	
	var content = {
		voicePath: voiceData.voicePath,
		duration: Math.ceil(voiceData.duration)
	};
	var messageType = 1;
	const msg = await sendMsg(messageType, vm.toTarget, content);
	vm.messages.push(msg);
	if (vm.stateConfig.isSound===1) {
		vm.playNotificationSound('send');
	}else if(vm.stateConfig.isSound===2){
		uni.vibrateShort()
	}
	console.log('语音长度' + JSON.stringify(vm.messages.length));
	vm.$nextTick(() => {
		vm.inputMsg = '';
		uni.pageScrollTo({
			scrollTop: 99999, // 设置一个超大值，以保证滚动条滚动到底部
			duration: 100
		});
	});
	
	
}